// Copyright@ChenChao

#pragma once

#include "CoreMinimal.h"
#include "Enums/ECharacterState.h"
#include "GameFramework/Character.h"
#include "Items/Item.h"
#include "RPG_CharacterBase.generated.h"

class UCameraComponent;
class USpringArmComponent;
class UGroomComponent;
class AItem;
class UAnimMontage;

UCLASS()
class RPG_API ARPG_CharacterBase : public ACharacter
{
	GENERATED_BODY()

public:
	// 构造函数
	ARPG_CharacterBase();
	
	// Tick事件
	virtual void Tick(float DeltaTime) override;

	// 输入组件
	virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;

protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
/**********************************************************************************************************************/
	/*前进函数*/
	void F_MoveForward(float Value);
	/*左右移动*/
	void F_MoveRight(float Value);
	/*左右转*/
	void F_Turn(float Value);
	/*上下看*/
	void F_LookUp(float Value);
	/*捡起装备*/
	void F_Equip();
	/*攻击动作*/
	void F_Attack();
	
/**********************************************************************************************************************/
private:
	UPROPERTY(VisibleAnywhere, Category = "Camera")
	USpringArmComponent* SpringArm;			//弹簧臂组件
	UPROPERTY(VisibleAnywhere, Category = "Camera")
	UCameraComponent* Camera;				//摄像机组件

	UPROPERTY(VisibleAnywhere, Category = "Hair")
	UGroomComponent* Hair;					//头发(梳理组件)
	UPROPERTY(VisibleAnywhere, Category = "Hair")
	UGroomComponent* Eyebrows;				//眉毛
	
	UPROPERTY(VisibleInstanceOnly)
	AItem* OverlappingItem;		//重叠物品

	/*枚举*/
	UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "enum", meta = (AllowPrivateAccess = "true"))
	ECharacterState CharacterState = ECharacterState::ECS_UnEquipped;		//角色状态
	
	UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "enum", meta = (AllowPrivateAccess = "true"))
	ECharacterAction ActionState = ECharacterAction::ECA_Unoccupied;		//角色活动状态
	
	/*动画蒙太奇属性*/
	UPROPERTY(EditDefaultsOnly, Category="Montage")
	UAnimMontage* AttackMontage;

	/* 动画蒙太奇函数*/
	//播放攻击蒙太奇
	UFUNCTION()
	void F_PlayAttackMontage();

	//攻击蒙太奇结束函数
	UFUNCTION(BlueprintCallable, Category="Montage")
	void F_AttackMontageEnd();
public:
	/*FORCEINLINE: 强制内联函数*/
	FORCEINLINE AItem* GetOverlappingItem() const
	{
		return OverlappingItem;
	}

	FORCEINLINE void SetOverlappingItem(AItem* const Item)
	{
		this->OverlappingItem = Item;
	}
	
	/*角色状态*/
	FORCEINLINE ECharacterState GetCharacterState() const
	{
		return CharacterState;
	}

	FORCEINLINE void SetCharacterState(const ECharacterState State)
	{
		CharacterState = State;
	}
};

